package generic;

import lombok.ToString;

/**
 * 元组 键一组对象直接打包存储于其中的一个单一对象
 * 容器对允许读取其中元素，但是不允许向其中存放新的对象
 */
public class Tuple {

    @ToString
    public static class TwoTuple<A,B>{
        public final A first;
        public final B second;
        public TwoTuple(A a,B b) {
            first = a;
            second = b;
        }
    }
    @ToString
    public static class ThreeTuple<A,B,C> extends TwoTuple<A,B>{
        public final C three;
        public ThreeTuple(A a, B b,C c) {
            super(a, b);
            three = c;
        }
    }

    @ToString
    public static class Tuple4<A,B,C,D> extends ThreeTuple<A,B,C>{
        public final D four;
        public Tuple4(A a,B b,C c,D d) {
            super(a,b,c);
            four = d;
        }
    }

}
